<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  
<script>
  let data = ['a', 'b']

  let p = new Proxy(data, {
    set(target, prop, newValue) {
      console.log(target, prop, newValue)
      return Reflect.set(...arguments)
    },
    get(target, prop) {
      console.log(target, prop)
      return Reflect.get(...arguments)
    }
  })

  p[2] = '1'

  console.log(p)
</script>

</body>
</html>